package com.project.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.common.BaseContext;
import com.project.common.R;
import com.project.entity.GlobalTime;
import com.project.mapper.GlobalTimeMapper;
import com.project.service.GlobalTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;

import java.time.LocalDate;

/**
 * ClassName: GlobalTimeServiceImpl
 * Package: com.project.service.impl
 * Description:
 *
 * @Author 看到风
 * @Create 2023/11/6 17:57
 * @Version 1.0
 */
@Service
public class GlobalTimeServiceImpl extends ServiceImpl<GlobalTimeMapper,GlobalTime> implements GlobalTimeService {
    @Autowired
    private GlobalTimeMapper globalTimeMapper;


    //设置全局时间
    public void saveGlobalTime(int code ,LocalDate beginDate,LocalDate endDate,Long projectId){
        GlobalTime globalTime=new GlobalTime();
        globalTime.setBeginDate(beginDate);
        globalTime.setEndDate(endDate);
        globalTime.setCode(code);
        globalTime.setProjectId(projectId);

        globalTimeMapper.save(globalTime);

    }

    //修改全局时间时信息回填
    public GlobalTime getInfoTime(int code,Long projectId){
        GlobalTime globalTime = globalTimeMapper.selectTime(code,projectId);
        return  globalTime;
    }

    //修改时间
    public void updateTime(GlobalTime globalTime){

        globalTimeMapper.update(globalTime);
    }

}
